home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <exec/memory.h>
-
- #include <intuition/intuition.h>
-
- #include <libraries/gadtools.h>
- #include <dos/dos.h>
-
- #include <clib/exec_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/gadtools_protos.h>
-
- #include "FlyingToaster.h"
- #include "FlyingToaster_rev.h"
- #include "/defs.h"
-
- struct mPrefObject {
- LONG Objects, Speed;
- };
-
- VOID blank( VOID );
-
- struct mPrefObject nP;
- STATIC const UBYTE VersTag[] = VERSTAG;
- extern struct Task **Task;
- extern UBYTE *prefData;
-
- #define MAX_SPEED 3
- #define MAX_OBJECTS 40
-
- VOID setFlyingToasterPrefs( VOID )
- {
- GT_SetGadgetAttrs( FlyingToasterGadgets[GD_OBJECTS], FlyingToasterWnd, 0L, GTSL_Level, nP.Objects , 0L );
- GT_SetGadgetAttrs( FlyingToasterGadgets[GD_SPEED], FlyingToasterWnd, 0L, GTSL_Level, nP.Speed, 0L );
- }
-
- int OKClicked( VOID )
- {
- CopyMem( &nP, prefData, sizeof( struct mPrefObject ));
- return( QUIT );
- }
-
- int TESTClicked( VOID )
- {
- *Task = FindTask( 0L );
- blank();
- return( CONTINUE );
- }
-
- int CANCELClicked( VOID )
- {
- return( QUIT );
- }
-
- int SPEEDClicked( VOID )
- {
- nP.Speed = FlyingToasterMsg.Code;
- return( CONTINUE );
- }
-
- int OBJECTSClicked( VOID )
- {
- nP.Objects = FlyingToasterMsg.Code;
- return( CONTINUE );
- }
-
- int FlyingToasterVanillaKey( VOID )
- {
- switch( FlyingToasterMsg.Code ) {
- case 'o':
- return( OKClicked() );
- case 't':
- return( TESTClicked() );
- case 'c':
- return( CANCELClicked() );
- case 'a':
- GT_SetGadgetAttrs( FlyingToasterGadgets[GD_OBJECTS], FlyingToasterWnd, 0L, GTSL_Level, ++(nP.Objects) > MAX_OBJECTS ?
- nP.Objects = MAX_OBJECTS : nP.Objects, 0L );
- return( CONTINUE );
- case 'A':
- GT_SetGadgetAttrs( FlyingToasterGadgets[GD_OBJECTS], FlyingToasterWnd, 0L, GTSL_Level, --(nP.Objects) < 1 ?
- nP.Objects= 1 : nP.Objects, 0L );
- return( CONTINUE );
- case 's':
- GT_SetGadgetAttrs( FlyingToasterGadgets[GD_SPEED], FlyingToasterWnd, 0L, GTSL_Level, ++(nP.Speed) > MAX_SPEED ?
- nP.Speed = MAX_SPEED : nP.Speed, 0L );
- return( CONTINUE );
- case 'S':
- GT_SetGadgetAttrs( FlyingToasterGadgets[GD_SPEED], FlyingToasterWnd, 0L, GTSL_Level, --(nP.Speed) < 1 ?
- nP.Speed= 1 : nP.Speed, 0L );
- return( CONTINUE );
- default:
- return( CONTINUE );
- }
- }
-
- VOID prefs( LONG command )
- {
- switch( command ) {
- case STARTUP:
- CopyMem( prefData, &nP, sizeof( struct mPrefObject ));
- if( !SetupScreen() ) {
- if( !OpenFlyingToasterWindow()) setFlyingToasterPrefs();
- CloseDownScreen();
- }
- break;
- case IDCMP:
- if( HandleFlyingToasterIDCMP() != QUIT ) break;
- case KILL:
- CloseFlyingToasterWindow();
- }
- }
-
- LONG winSig( VOID )
- {
- return( FlyingToasterWnd ? 1L << FlyingToasterWnd->UserPort->mp_SigBit : 0L );
- }
-